These correspond to the exercises. Remember to load tidyverse.
library(tidyverse)
Make a simple point plot of Petal.Length on x and Petal.Width on y http://r-statistics.co/Complete-Ggplot2-Tutorial-Part1-With-R-Code.html
Change X axis label to “Width” and “Length”
Change the Y scale to 0 - 4 http://www.sthda.com/english/wiki/ggplot2-axis-scales-and-transformations
Try adding a different themes and find something you like https://www.datanovia.com/en/blog/ggplot-themes-gallery/
Add a colour on each dot to its respective Species http://www.sthda.com/english/wiki/ggplot2-colors-how-to-change-colors-automatically-and-manually
Change “ticks”/“breaks” on x axis to display: 1,2,3,4,5,6,7
Change Y axis to display: 0,1,2,3
Try to remove the legend completely https://stackoverflow.com/questions/35618260/remove-legend-ggplot-2-2
Add a linear regression model
Make the linear regression model fit through the entire data, not subdivided on Species
Same as before but make the regression line “slateblue” and remove standard error markings
Use the mtcars dataset. Write: data(mtcars) Create a violinplot with x = as.factor(cyl),y = displ
Add the rawdata as points
http://sape.inf.usi.ch/quick-reference/ggplot2/colour Make the violin edges dodgerblue1 and violin fill as tomato1, theme(classic), dots as magenta1 Make the violins transparent 50 %
Make the colors depend on aes cyl
Make the colors depend on aes as.factor(cyl)
Replace the violins with traditional boxplots See for example cheatsheet: https://rstudio.com/wp-content/uploads/2015/03/ggplot2-cheatsheet.pdf
Make a regular point plot with x = disp, y = mpg, color = factor(cyl), but facet_wrap the plot into am (automatic gear or not) http://www.cookbook-r.com/Graphs/Facets_(ggplot2)/
Do the same but make the size of each point depend on horsepower (hp)
Use the ChickWeight dataset: data(ChickWeight) Make a simple linegraph using x = time, y = weight
What went wrong here?
Make a simple linegraph using x = time, y = weight, group = Chick
Give each chick a different colour on the line
Give each chick a different colour on the line, but hide the ugly legend
Do the same graph but now make the color = Diet and show legend